
//
//  PdcTableViewCell.m
//  EcmDoctor
//
//  Created by Mac on 16/2/25.
//  Copyright © 2016年 张进. All rights reserved.
//

#import "PdcTableViewCell.h"
#import "Treatmentsm.h"
@implementation PdcTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)treatmentOptions:(id)sender {
    NSString *docId= [SSKeychain passwordForService:APP_SERVICE_NAME account:APP_DOCTORINFOID_KEY];
    [Treatmentsm  requetDoctorpcWith:docId And:self.askid success:^(NSArray *treatmentsAry) {
        [self.delegate treatments:treatmentsAry];
     
    } failure:^(NSError *error) {
        NSLog(@"%@",error.localizedDescription);
    }];
    NSLog(@"----------------");
}

- (IBAction)questionDetail:(id)sender {
    NSLog(@"================");
    
    UIViewController *controller = [self findViewController:self];
    if ([_qutype.text isEqualToString:@"免费义诊"]) {
        [controller performSegueWithIdentifier:@"toYiZhen" sender:_askid];
        
    } else if ([_qutype.text isEqualToString:@"在线问诊"]) {
        [controller performSegueWithIdentifier:@"toOnline" sender:_askid];
    } else if ([_qutype.text isEqualToString:@"电话问诊"]) {
        [controller performSegueWithIdentifier:@"toTel" sender:_askid];
    } else if ([_qutype.text isEqualToString:@"门诊加号"]) {
        [controller performSegueWithIdentifier:@"toClinic" sender:_askid];
    }
    
    
}

- (UIViewController *)findViewController:(UIView *)sourceView
{
    id target=sourceView;
    while (target) {
        target = ((UIResponder *)target).nextResponder;
        if ([target isKindOfClass:[UIViewController class]]) {
            break;
        }
    }
    return target;
}

@end
